<template>
  <div class="over-view overview-view">
    <div class="page-title">
      <div>白龙潭社区居民档案管理系统</div>
      <div class="time">{{ nowTime }}</div>
    </div>

    <el-card class="tongji">
      <div slot="header" class="clearfix">
        <span style="line-height: 36px;">基本信息</span>
      </div>
      <el-row :gutter="32">
        <el-col :span="8" v-for="x in data_a" :key="x.item">
          <div class="show">
            {{ x.item }}： {{ x.num }}人
          </div>
        </el-col>

        <el-col :span="8" v-for="y in data_b" :key="y.item">
          <div class="show">
            {{ y.item }}： {{ y.num }}人
          </div>
        </el-col>
      </el-row>
    </el-card>

    <el-card class="bar">
      <div slot="header" class="clearfix">
        <span style="line-height: 36px;">信息分布</span>
      </div>
     <el-row>
       <el-col :span="12">

       </el-col>
       <el-col :span="12">

       </el-col>
     </el-row>
    </el-card>

    <el-card class="age">
      <div slot="header" class="clearfix">
        <span style="line-height: 36px;">年龄层次</span>
      </div>
      <el-row>
        <el-col :span="24">

        </el-col>
      </el-row>
    </el-card>

    <el-card class="xx">
      <div slot="header" class="clearfix">
        <span style="line-height: 36px;">系统信息</span>
      </div>
      <el-row>
        <el-col :span="12">
          <div class="info-list">
            <ul>
              <li>开发商：云南师范大学信息学院</li>
              <li>保密级别：
                <el-rate
                  style="display: inline-block"
                v-model="rate"
                disabled
                text-color="#ff9900">
              </el-rate></li>
              <li>
                使用方：白龙潭社区
              </li>
              <li>
                系统地址：http://www.baidu.com
              </li>
            </ul>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="info-list">
            <ul>
              <li><el-button size="samll" @click="apis" type="text">api</el-button></li>
              <li>2</li>
              <li>3</li>
              <li>4</li>
            </ul>
          </div>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>


<script>
  import dateformat from 'dateformat'
  import { httpPost } from '../util/api'

  export default {
    name: 'over-view',
    data() {
      return {
        timer: 0,
        rate: 5.0,
        nowTime: '----年--月--日 00:00:00',
        data_a: [
          {
            item: '等待同步',
            num: 0
          },
          {
            item: '等待同步',
            num: 0
          },
          {
            item: '等待同步',
            num: 0
          }],
        data_b: [
          {
            item: '等待同步',
            num: 0
          },
          {
            item: '等待同步',
            num: 0
          },
          {
            item: '等待同步',
            num: 0
          }],
      }
    },
    created() {
      this.setTime()
    },
    methods: {
      apis() {
        httpPost('/auth').then((response) => {
          console.log(response.data)
        })
      },
      setTime() {
        this.nowTime = dateformat(new Date(), 'yyyy年mm月dd日 HH:MM:ss')
        this.timer = setTimeout(this.setTime, 1000)
      }
    },
    beforeRouteLeave(form, to, next) {
      clearTimeout(this.timer)
      next()
    },
  }
</script>


<style lang="scss">
  @import "../scss/theme";

  span {
    line-height: 10px;
  }

  .el-card {
    background-color: $background;
    .el-card__header {
      padding: 4px 20px;
    }
  }

  .info-list {
    li {
      list-style-type: none;
      height: 28px;
      line-height: 28px;
      color: $kedark;
      &:hover {
        color: $color;
      }
    }
  }
  .overview-view .el-card {
    margin-bottom: 20px;
  }
  .tongji .el-col {
    min-height: 80px;
    display: flex;
    justify-content: center;
    align-content: center;
    margin-top: 20px;
    .show {
      height: 80px;
      width: 100%;
      line-height: 80px;
      text-align: center;
    }
  }

  .page-title {
    font-size: 24px;
    text-transform: capitalize;
    color: $color;
    padding: 30px 0 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .time {
      color: $kedark;
      font-size: 18px;
    }
  }

  .overview-view .box-card {
    margin-top: 30px;
  }

  .el-table--enable-row-hover tr:hover > td {
    background-color: #37363b;
  }

  .overview-view .el-row {
    margin-bottom: 10px;
  }

  .overview-view .el-row:last-child {
    margin-bottom: 0;
  }

  .overview-view .el-col {
    border-radius: 4px;
  }

  .overview-view .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }

  .overview-view .el-table {
    border-color: #1f1d1d;
  }

  .overview-view .el-table__row:hover {
    background-color: #37363b;
  }

  .overview-view .status:before {
    content: "";
    display: inline-block;
    height: 8px;
    width: 8px;
    margin-right: 3px;
    border-radius: 4px;
  }

  .overview-view .running:before {
    background-color: #227D51;
  }

  .overview-view .stopped:before {
    background-color: #777777;
  }

  .overview-view .running {
    color: #227D51;
  }
</style>
